/**
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 * <p>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
//  reusable blocks
%profile-component {
  padding: .75rem;
  background: $bg-faded;
  border: 1px solid $border-color-default;
  border-radius: $border-radius;
  margin-bottom: $grid-gutter-width;
}

.profile-wrapper {
  display: flex;
  flex-direction: column;
  @include media-breakpoint-up(md) {
    flex-direction: row;
  }
  body.menubar-top & {
    border: 1px solid $border-color-default;
  }
}

//  profile user section
.profile-section-user {
  border-right: 1px solid $border-color-default;
  flex: 0 0 100%;
  background-color: #fbfbfb;

  @include media-breakpoint-up(md) {
    flex-basis: 34%;
  }

  @include media-breakpoint-up(lg) {
    flex-basis: 30%;
  }
  
  table {
    margin-bottom: 0;
  }

  table td {
    border: none;
    padding-left: 0;
    padding-right: 0;
  }

  .img-gallery [class*="col"] {
    padding-right: .25rem;
    padding-left: .25rem;
  }

  .img-gallery .row {
    margin-right: -.25rem;
    margin-left: -.25rem;
  }
  
  .img-gallery .g__item {
    margin-bottom: .5rem;
  }
}

.profile-cover-img img {
  width: 100%;
  height: auto;
}

.profile-info-brief {
  position: relative;
  padding-top: 74px !important;

  .user-profile-avatar {
    width: 100px;
    height: 100px;
    border-radius: 100%;
    position: absolute;
    top: -50px;
    left: calc(50% - 50px;);
  }
}

// profile main section
.profile-section-main {
  flex: 0 1 5000px;
  overflow: hidden;
}

.profile-tabs {
  padding: ($grid-gutter-width / 2) $grid-gutter-width 0;
  background: $bg-faded;
  border-top: 1px solid $border-color-default;

  .nav-link {
    font-weight: 400;
    padding: .75rem 1.5rem;
    
    &:focus,
    &:active,
    &.active:focus,
    &.active:hover,
    &.active {
      color: $brand-success;
    }
  }
}

.profile-tabs-content {
  .tab-pane {
    padding: $grid-gutter-width;
  }
}

.post-editor {
  @extend %profile-component;

  .post-field {
    width: 100%;
    height: 120px;
    resize: vertical;
    border-radius: $border-radius;
    margin-bottom: .5rem;
    padding: .5rem;
    border-color: $border-color-default;
    &:focus {
      box-shadow: none;
      outline: none;
    }
  }
}


// stream posts
.stream-post {
  @extend %profile-component;
  position: relative;
}

.sp-author {
  display: flex;

  .sp-author-avatar {
    display: inline-block;
    height: 64px;
    width: 64px;
    margin-right: 16px;
  }

  .sp-author-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
  }
  
  .sp-author-name {
    font-size: 1rem;
    margin: .5rem 0;
  }

  @include media-breakpoint-up(lg) {
    position: absolute;
    width: 100%;
    left: 1rem;
    top: 1rem;

    .sp-author-name {
      margin: 0;
      position: absolute;
      left: 80px;
      top: 8px;
      background: rgba(0,0,0,.9);
      padding: .75rem 1.5rem;
      border-radius: 6px;
      z-index: -1;
      opacity: 0;
      transform: rotate(90deg);
      transform-origin: left center;
      transition: opacity .3s, transform .3s;
      > a { color: #fff; }
    }
    
    .sp-author-avatar:hover + .sp-author-name { 
      opacity: 1;
      z-index: 9999;
      transform: rotate(0);
    }

    .sp-author-name::after {
      content: '';
      display: block;
      position: absolute;
      left: -8px;
      top: 50%;
      transform: translateY(-50%);
      border-top: 8px solid transparent;
      border-bottom: 8px solid transparent;
      border-right: 8px solid rgba(0,0,0,.9);
    }
  }
}

.sp-content {
  position: relative;
  border-radius: $border-radius;
  background: #fff;
  padding: 1rem;
  margin-top: 1rem;

  .sp-info {
    font-size: .875rem;
    color: $text-muted;
    position: absolute;
    top: -3rem;
    left: 80px;
  }

  .sp-paragraph {
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 1rem;
    &:last-child {
      margin-bottom: 0;
    }
  }
  
  .sp-gallery img {
    margin-right: .5rem;
    margin-bottom: .5rem;
    max-width: 220px;
    max-height: 130px;
  }

  .sp-video {
    width: 100%;
    height: auto;
  }

  @include media-breakpoint-up(lg) {
    margin-left: 80px;
    margin-top: 0;
    .sp-info {
      position: static;
      font-style: italic;
      margin-bottom: 1rem;
    }
  }
}

// profile settings tab
#profile-settings {
  textarea {
    padding: 1rem;
    line-height: 1.8;
    height: 140px;
    font-style: italic;
  }
  
  label {
    font-size: 1rem;
  }

  .form-control {
    color: grayscale(600);
    &,
    &:focus {
      box-shadow: none;
      outline: none;
    }
  }
}

.edit-cover {
  position: relative;
  padding: .5rem;
  border-radius: $border-radius;
  border: 1px solid $border-color-default;
  background: $bg-faded;
  height: 400px;
  img {
    border-radius: $border-radius;
    width: 100%;
    height: 100%;
  }

  .btn {
    position: absolute;
    right: 32px;
    bottom: 32px;
  }
}
